package com.own.component.util.excel.util.read.base;

import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;

import java.io.Serializable;
import java.util.function.Function;

/**
 * BaseExcelReadConfig
 *
 * @author chenxueli
 * @date 2022-10-10 10:33:00
 */
@Getter
@Setter
public abstract class BaseExcelReadConfig<T> extends BaseZipExcelReadConfig<T> implements Serializable {

    /**
     * 带读取的表格名称
     */
    private String sheetName;

    /**
     * 待读取的表格位置（优先级在sheetName之后）
     */
    private int sheetIndex;

    /**
     * 数据格式处理
     */
    private Function<String, String> resolveValue;

    /**
     * 是否需要读取合并单元格的信息
     */
    private boolean readMergedValue;

    /**
     * 是否需要统一读取时间格式
     */
    private boolean unitDateFormat;

    /**
     * 默认的时间格式的处理
     */
    private String resolveDateTime;

    /**
     * 读取的表格信息
     */
    private Sheet sheet;

    public BaseExcelReadConfig() {
        super();
        this.sheetIndex = 0;
        this.readMergedValue = true;
        this.resolveValue = StringUtils::trim;
        this.unitDateFormat = true;
        this.resolveDateTime = "yyyy-MM-dd HH:mm:ss";
    }

}
